<!DOCTYPE html>
<html lang="en" xmlns:th="https://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>编辑学生</title>
    <style>
        body {
            background-color: #cccccc;
        }

        h1 {
            text-align: center;
        }

        form {
            width: 500px;
            margin: 0 auto;
            margin-top: 200px;
            padding: 60px;
            background-color: white;
            border-radius: 10px;
            box-shadow: 5px 5px 10px 0 rgba(0, 0, 0, 0.5);
        }

        input, select {
            padding-top: 10px;
            padding-bottom: 10px;
            margin-top: 10px;
            margin-bottom: 10px;
            width: calc(100% - 90px);
        }

        input[type = 'radio'] {
            width: 20px;
        }

        input[type = 'submit'] {
            width: 100%;
            background-color: #6abb91;
        }

        span {
            display: inline-block;
            width: 80px;
        }
    </style>
</head>
<body>
<form th:action="@{/student/saveStudent}" method="post">
    <span>ID：</span><input type="text" name="id" th:value="${student.id}" readonly><br>
    <span>姓名：</span><input type="text" name="name" th:value="${student.name}"><br>

    <span>性别：</span>
    <input type="radio" name="sex" value="男" th:checked="${student.sex} == '男'">男
    <input type="radio" name="sex" value="女" th:checked="${student.sex} == '女'">女
    <br>

    <span>年龄：</span><input type="number" name="age" th:value="${student.age}"><br>

    <span>学号：</span><input type="text" name="stuId" th:value="${student.stuId}" maxlength="12"><br>
    
    <span>班级：</span>
    <select name="className" th:value="${student.className}">
        <option value="23软开1班" th:selected="${student.className} == '23软开1班'">软开1班</option>
        <option value="23软开2班" th:selected="${student.className} == '23软开2班'">软开2班</option>
        <option value="23软开3班" th:selected="${student.className} == '23软开3班'">软开3班</option>
    </select>

    <span>辅导员：</span>
    <select name="teacherId" th:value="${student.className}">
        <option th:each="teacher : ${teacherList}" th:value="${teacher.id}" th:selected="${student.teacherId} == ${teacher.id}">[[${teacher.name}]]</option>
    </select>
    <br>

    <span>是否毕业：</span>
    <input type="radio" name="isGraduate" value="true" th:checked="${student.isGraduate}">是
    <input type="radio" name="isGraduate" value="false" th:checked="!${student.isGraduate}">否
    <br>

    <input type="submit" value="保存">
</form>
</body>
</html>